/**
 * 
 */
package com.huarui.desktop.service.impl;

import java.util.List;
import java.util.Map;

import org.ewaf.framework.model.PagingInfo;

import com.huarui.desktop.dao.TableDataDao;
import com.huarui.desktop.model.TableMetaData;
import com.huarui.desktop.service.TableRecordDataService;

/**
 * @author sunpeng
 * 
 */
public class DefaultTableRecordDataService implements TableRecordDataService {

	private TableDataDao tableDataDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.huarui.desktop.service.TableRecordDataService#list(com.huarui.desktop
	 * .model.TableMetaData, org.ewaf.framework.model.PagingInfo)
	 */
	@Override
	public void list(TableMetaData metaData, PagingInfo<String, Map<String, Object>> paginInfo) {

		List<Map<String, Object>> items = this.tableDataDao.selectAllData(metaData, paginInfo.getStart(), paginInfo.getLimit());
		int total = this.tableDataDao.selectCount(metaData.getName());
		paginInfo.setTotal(total);
		paginInfo.setItems(items);
	}

	public void setTableDataDao(TableDataDao tableDataDao) {
		this.tableDataDao = tableDataDao;
	}

}
